<%--
  Created by IntelliJ IDEA.
  User: yyf19
  Date: 2019/6/14
  Time: 17:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>商品</title>
    <%@ include file="/WEB-INF/jsp/include/head.jsp" %>
</head>
<body>
<div>
    <%@ include file="/WEB-INF/jsp/include/nav.jsp" %>
    <div class="jumbotron" style="margin: 0;">
        <div class="container">
            <h1>Hello, world!</h1>
            <p>...</p>
            <p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a></p>
        </div>
    </div>
</div>
<div class="container" id="product-box">

    <hr/>

    <%--<div class="panel panel-default col-md-2 product-box">
        <div class="panel-heading">
            <h3 class="panel-title">Panel title</h3>
        </div>
        <div class="panel-body">
            <a href="#" class="thumbnail"><img src="..." alt="..."> </a>
        </div>
    </div>--%>


</div>

</body>
<%@ include file="/WEB-INF/jsp/include/bodyfoot.jsp" %>
<script>
    var url = serverApp + "/product/page";
    var data = {
        pageNum: 1,
        pageSize: 20
    }
    $POST_JSON(url, data, function (result) {
        var $productBox = $("#product-box");
        var list = result.list;
        for (var i = 0; i < list.length; i++) {
            var box = ""
            box += '<div class="panel panel-default product-box">';
            box += '<div class="panel-body product-panel-body">';
            box += '<a href="' + serverApp + '/product/toGet/' + list[i].id + '" class="thumbnail main-image-box" ><img src="' + list[i].mainImage + '" alt="..."> </a>';
            box += '<div class="panel-footer product-box-footer product-box-price">￥' + keep2smallNumber(list[i].price) + '</div>';
            box += '<div class="panel-footer product-box-footer">' + list[i].name + '</div>';
            box += '</div>';
            $productBox.append(box);
        }
    })


</script>
</html>
